package com.zmn.plat.services.impl.servcateory;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.zmn.plat.model.entity.servcategory.ShowCategoryAssociation;
import com.zmn.plat.model.entity.servcategory.ShowCategoryAssociationQuery;
import com.zmn.plat.model.entity.servcategory.ShowCategoryAssociationVO;
import com.zmn.plat.persistence.interfaces.servcategory.ShowCategoryAssociationDAO;
import com.zmn.plat.services.interfaces.servcategory.ShowCategoryAssociationService;

/**
 * 描述：前后台分类关联关系Service实现类
 *
 * @author tanghongjun
 * @since 2019/9/20 11:20
 **/
@Service
public class ShowCategoryAssociationServiceImpl implements ShowCategoryAssociationService {
    @Resource
    private ShowCategoryAssociationDAO showCategoryAssociationDAO;

    @Override
    public ShowCategoryAssociation findByKey(Integer relationId) {
        return showCategoryAssociationDAO.findByKey(relationId);
    }

    @Override
    public Integer findKeyForMax() {
        return showCategoryAssociationDAO.findKeyForMax();
    }

    @Override
    public List<ShowCategoryAssociation> listPageByQuery(ShowCategoryAssociationQuery query) {
        return showCategoryAssociationDAO.listPageByQuery(query);
    }

    @Override
    public List<ShowCategoryAssociation> listByQuery(ShowCategoryAssociationQuery query) {
        return showCategoryAssociationDAO.listByQuery(query);
    }

    @Override
    public List<ShowCategoryAssociationVO> listServCategByShowCategId(Integer showCategId) {
        return showCategoryAssociationDAO.listServCategByShowCategId(showCategId);
    }

    @Override
    public List<ShowCategoryAssociation> listByChannelAndShowType(Integer channelId, Integer showType) {

        if (Objects.isNull(channelId) || Objects.isNull(showType)) {
            return Collections.emptyList();
        }
        return showCategoryAssociationDAO.listByChannelAndShowType(channelId, showType);
    }

    @Override
    public List<ShowCategoryAssociation> listAll() {
        return showCategoryAssociationDAO.listAll();
    }

    @Override
    public Integer countByQuery(ShowCategoryAssociationQuery query) {
        return showCategoryAssociationDAO.countByQuery(query);
    }

    @Override
    public Integer updateByKey(ShowCategoryAssociation showCategoryAssociation) {
        return showCategoryAssociationDAO.updateByKey(showCategoryAssociation);
    }

    @Override
    public Integer insert(ShowCategoryAssociation showCategoryAssociation) {
        return showCategoryAssociationDAO.insert(showCategoryAssociation);
    }

    @Override
    public Integer insertBatch(List<ShowCategoryAssociation> showCategoryAssociationList) {
        return showCategoryAssociationDAO.insertBatch(showCategoryAssociationList);
    }

    @Override
    public Integer deleteByKey(Integer relationId) {
        return showCategoryAssociationDAO.deleteByKey(relationId);
    }

    @Override
    public Integer deleteByShowServId(Integer showServCategId, Integer showCategOneId, Integer showCategId) {
        return showCategoryAssociationDAO.deleteByShowServId(showServCategId, showCategOneId, showCategId);
    }

    @Override
    public List<ShowCategoryAssociationVO> listByShowCategoryId(Integer servCategId, Integer categOneId, Integer categId) {
        return showCategoryAssociationDAO.listByShowCategoryId(servCategId, categOneId, categId);
    }

    @Override
    public List<ShowCategoryAssociationVO> listByCategoryId(Integer servCategId, Integer categOneId, Integer categId) {
        return showCategoryAssociationDAO.listByCategoryId(servCategId, categOneId, categId);
    }

    @Override
    public Integer deleteByServCategIdAndCategOneIdAndCategId(String[] ids) {
        return showCategoryAssociationDAO.deleteByServCategIdAndCategOneIdAndCategId(ids);
    }

    @Override
    public Integer deleteByShowServCategIdAndShowCategOneIdAndShowCategId(String[] ids) {
        return showCategoryAssociationDAO.deleteByShowServCategIdAndShowCategOneIdAndShowCategId(ids);
    }
}
